<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta content="user-scalable=no,width=device-width, initial-scale=1" id="viewport" name="viewport" initial-scale="1">

<script language="javascript" type="text/javascript" src="../js/js/baseJs.js"></script>

</head>
<body style="background: #eff6ff">

<div class="code-share" id="codeShare" style="display: none;">
    <div class="wap-header">我的邀请码
        <a class="back" onClick="javascript:window.history.back();return false;"></a>
    </div>
    <div class="code-content-bd"> 
        <div class="c-bd"> 
          <div class="title">我的专属邀请码</div>
          <div class="code">{{invitationCode}}</div>
           <div id="qrcode" style="width:200px; height:200px; margin: .2rem auto;"></div>
            <div class="code-info">
                <div class="l-c"><div class="info">规则说明：</div></div>
                <div class="l-c">*用户通过您的邀请码注册账号后，即刻成为您的下线用户，下线用户成功办理业务后，您都可以直接获得一级分成</div>
                <div class="l-c">*您的下线推广成功的用户，办理业务成功，你还可以获得二级分成</div>
                <div class="l-c">*分成最多可以获得二级用户的，二级一下不计分成</div>
                <div class="l-c">*最终解释权归来赚吧平台所有</div>
            </div>
         </div>
    </div>
</div>
<script src="../js/js/rem_fix.js"></script>
<script src="../js/js/common.js"></script>
<script src="../js/3rd/qrcode.min.js"></script>
<script type="text/javascript">
   var token=getCookie("userToken");
   var userId=getCookie("userId");
   console.log(token)
   console.log(userId)
   var loginUrl="/userBundle/login.mobile.html"
   
    var qrcode = new QRCode(document.getElementById("qrcode"), {
      width : 200,
      height : 200
    });
   
  var shareProjectApp = new Vue({
      el: '#codeShare', 
      data: {
          invitationCode:'',
		  recommandUrl:''
      },
      ready:function(){
        $("#codeShare").show();
        if(!userId||!token){
          window.location.href=loginUrl;
        }
        var getUserUrl="/user/getUserById";
        var data={
          client:1,
          token:token,
          userId:userId
        }
        pushData(getUserUrl,data,function(res){
          console.log(res)
            if(res.state){
              this.invitationCode=res.data.user.invitationCode;
			  this.recommandUrl="http://"+window.location.host+"/userBundle/register.mobile.html"+"?id=#goldSeed"+"&invitationCode="+this.invitationCode;
			  console.log(this.recommandUrl)
			  this.makeCode()
            }else{
              alert(res.message);
            }
        }.bind(this))
      }, 
      methods:{
		 makeCode:function(){
		   if(!this.invitationCode){
			 alert("请登录")
		   }
		   qrcode.makeCode(this.recommandUrl);
		 }
       
      }
    })
</script>

</body>
</html>